<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/common.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui">

    <ui:define name="title">
        Candidate List
    </ui:define>

    <ui:define name="head">
 <script>
            $(function() {
                $(document).tooltip();
            });
        </script>
        <style>
            label {
                display: inline-block;
                width: 100px;
            }
        </style>
        <link rel="stylesheet" href="../../res/css/admin-style.css"/>
    </ui:define>

    <ui:define name="pageheader">
        Candidate list
    </ui:define>

    <ui:define name="content">
        <h:form id="mainform">
            <h:selectOneMenu value="#{candidate.mode}" >
                <f:selectItem itemValue="2" itemLabel="Staff" />
                <f:selectItem itemValue="3" itemLabel="Student" />
                <f:ajax render="@form" />
            </h:selectOneMenu>
            <h:panelGroup id="pn1" rendered="#{candidate.mode == 3}">
                <h3>Student candidates</h3>
                <p:dataTable styleClass="main-table" value="#{candidate.listStu}" var="s" style="width:100%; ">
                   
                    <p:column>
                        <f:facet name="header">
                            <h:commandLink value="Account ID" />
                        </f:facet>
                        #{s.accounts.accountId}
                    </p:column>
                    <p:column >
                        <f:facet name="header">
                            <h:commandLink value="Staff ID" />
                        </f:facet>
                        #{s.studentId}
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:commandLink value="User name" />
                        </f:facet>
                        #{s.accounts.userName}
                    </p:column>
                    <p:column>
                        <f:facet name="header">
                            <h:commandLink value="Full name" />
                        </f:facet>
                        #{s.accounts.fullName}
                    </p:column>
                    <p:column >
                        <f:facet name="header">
                            <h:commandLink value="Email" />
                        </f:facet>
                        <h:outputText value="#{s.accounts.email}">
                        </h:outputText>
                    </p:column>
                   
                    <p:column >
                        <f:facet name="header">
                            <h:commandLink value="Address" />
                        </f:facet>
                        <h:outputText value="#{s.accounts.address}">
                        </h:outputText>
                    </p:column>
                    <p:column >
                        <f:facet name="header">
                            <h:commandLink value="Birthday" />
                        </f:facet>
                        <h:outputText value="#{s.accounts.birthday}">
                            <f:convertDateTime type="date" pattern="dd-MM-yyyy" timeZone="GMT+7"/>

                        </h:outputText>
                    </p:column>


                    <p:column >
                        <f:facet name="header" >
                            Options
                        </f:facet>
                        <h:commandButton value="Accept" class="classname" action="#{candidate.accept(s.studentId)}" />
                    </p:column>

                </p:dataTable>
            </h:panelGroup>
        </h:form>
    </ui:define>

</ui:composition>
